#ifndef _LIGHT_H_
#define _LIGHT_H_

#include <glm/glm.hpp>
#include "sdl_event.h"
#include "scene.h"

class Light : public sdl::EventListener {
public:
	Light(const glm::vec3& pos, float intensity);

	// Calculate color for intersection point.
	// If scene is provided calculation will consider shadow.
	glm::vec3 calcColor(
		const Intersection& i, const Scene* scene = NULL);

	void setShadowAlpha(float a) {
		_shadowAlpha = a;
	}

	const glm::vec3& getPos() const {
		return _pos;
	}

private:
	void on(EventListener::NewEvent, const SDL_Event*) throw();

	glm::vec3 _pos;
	glm::vec3 _color;
	float _shadowAlpha;
};

#endif // _LIGHT_H_

